package com.example.springboot_sp.mapper;

import com.example.springboot_sp.entity.Collection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 郭守军
 * @since 2022-09-09
 */
public interface CollectionMapper extends BaseMapper<Collection> {
    @Select("select * from t_collection where userid = #{userid}")
    List<Collection> getCollectInformationByUserid(@Param("userid")  Integer userid);


    @Select("select articleid from t_collection where userid = #{userid}")
    List<Integer> getarticleIdonByUserid(@Param("userid")  Integer userid);

    @Delete("delete FROM t_collection where userid=#{userid} and articleid=#{articleid} ")
    void removeByUseridAndArticleId(@Param("userid") Integer userid,@Param("articleid") Integer articleid );
}
